from django.db import models


# Create your models here.

class Account(models.Model):
    id = models.AutoField(db_column='id', verbose_name='id', primary_key=True, unique=True)
    name = models.CharField(db_column='name', verbose_name='账号', unique=True, max_length=32,
                            help_text='登录账号', editable=True)
    password = models.CharField(db_column='password', verbose_name='密码', unique=True, max_length=32,
                                help_text='密码', editable=True)
    question = models.CharField(db_column='question', verbose_name='问题', max_length=64, help_text='找回密码问题',
                                editable=True)
    answer = models.CharField(db_column='answer', verbose_name='答案', max_length=64, help_text='找回密码答案', editable=True)
    email = models.CharField(db_column='email', verbose_name='邮箱', max_length=64, help_text='email', editable=True)
    qq = models.CharField(db_column='qq', verbose_name='qq', max_length=16, help_text='qq', editable=True)
    tel = models.CharField(db_column='tel', verbose_name='手机号码', max_length=16, help_text='手机号码', editable=True)

    ID_TYPE_CHOICES = (
        ('IdCard', 'IdCard'),
    )
    id_type = models.CharField(db_column='id_type', verbose_name='id_type', max_length=12, choices=ID_TYPE_CHOICES,
                               default=ID_TYPE_CHOICES[0], editable=True)
    id_card = models.CharField(db_column='id_card', verbose_name='id_type', max_length=32, null=True, blank=True,
                               editable=True)
    point = models.IntegerField(db_column='point', verbose_name='点数', default=0)

    class Meta:
        db_table = 'account'
        verbose_name = "账号"
        verbose_name_plural = "账号列表"
        unique_together = ('id', 'name')

    def __str__(self):
        return self.name
